/**
 * 
 */
package root.board.pieces;

import java.util.ArrayList;

import root.board.Piece;
import root.board.moviment.Moviment;
import root.board.moviment.Position;

/**
 * @author Calebe
 * 
 */
public class Tower extends Piece {

	public Tower() {
		super();
	}

	/**
	 * @param team
	 */
	public Tower(int team) {
		super(team);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see root.board.PieceInterface#moviments(int, int)
	 */
	@Override
	public Moviment[] moviments(int x, int y) {

		ArrayList<Moviment> moviments = new ArrayList<Moviment>();
		Position currPos = new Position(x, y);
		for (int coluna = x + 1; coluna <= 7; coluna++) {
			moviments.add(new Moviment(currPos, new Position(coluna, y)));
		}
		for (int coluna = x - 1; coluna >= 0; coluna--) {
			moviments.add(new Moviment(currPos, new Position(coluna, y)));
		}
		for (int linha = y + 1; linha <= 7; linha++) {
			moviments.add(new Moviment(currPos, new Position(x, linha)));
		}
		for (int linha = y - 1; linha >= 0; linha--) {
			moviments.add(new Moviment(currPos, new Position(x, linha)));
		}
		Moviment[] moviments2 = new Moviment[moviments.size()];
		int cont = 0;
		for (Moviment moviment : moviments) {
			moviments2[cont++] = moviment;
		}
		return moviments2;
	}
}
